package cn.pupil.springframework.context.event;

import cn.pupil.springframework.context.ApplicationEvent;

/**
 * @Description: 应用上下文事件
 * @Author: pupil
 * @Date: 2024/11/13 上午 11:27
 */
public class ApplicationContextEvent extends ApplicationEvent {
    /**
     * Constructs a prototypical Event.
     * 构造一个原型事件.
     *
     * @param source The object on which the Event initially occurred.
     * @throws IllegalArgumentException if source is null.
     */
    public ApplicationContextEvent(Object source) {
        super(source);
    }

    /**
     * Get the <code>ApplicationContext</code> that the event was raised for
     * 获取引发事件的<code>ApplicationContext</code>
     *
     * @return
     */
    public final ApplicationEvent getApplicationContext() {
        // 获取事件源(返回触发该事件的对象)
        return (ApplicationEvent) getSource();
    }
}
